#include<bits/stdc++.h>
#define ll long long
using namespace std;

int n;
int a[200005];
int used[200005];

int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	
	for(int i=1;;i++){
		bool flag=1;
		int k=-1;
		for(int j=1;j<=n;j++){
			if(used[j])continue;
			if(a[j]==k)continue;
			flag=0;
			used[j]=1;
			k=a[j];
			printf("%d ",j);
		}
		if(flag)break;
		printf("\n");
	}
	return 0;
}

